$(function(){
    var scrolling = false;
    var curFirstItemIndex = 0;
    var sectionsEl = $('.section-wrapper').find('.section');
    var itemNum = sectionsEl.length;
    var scrollLength = sectionsEl.eq(1).offset().left - 
        sectionsEl.eq(0).offset().left;
    $('.section-wrapper').bind('mousewheel', function(event, delta){
        $(this).unbind('mousewheel');
        var fn = arguments.callee;

        //lock the scrolling
        if(scrolling){
            return;
        }else{
            scrolling = true;
        }

        //do scroll
        if(delta > 0 && curFirstItemIndex > 0){
            //mousewheel up, move to right
            $(this).css({'margin-left': scrollLength * (-1 * curFirstItemIndex + 1)});
            curFirstItemIndex --;
        } 
        else if(delta < 0 && curFirstItemIndex + 3 < itemNum){
            //mousewheel down, move to left
            $(this).css({'margin-left': scrollLength * (-1 * curFirstItemIndex - 1)});
            curFirstItemIndex ++;
        }

        //rebind it
        setTimeout($.proxy(function(){
            scrolling = false;
            $(this).bind('mousewheel', fn);
        }, this), 400);
        console.log(this);
    });
});
